<template>
  <el-table
    :data="healthTableData"
    class="healthtable-query"
    style="width: 90%"
  >
    <el-table-column type="expand">
      <template slot-scope="props">
        <el-form label-position="left" inline class="demo-table-expand">
          <el-form-item label="表单编号">
            <span>{{ props.row.formno }}</span>
          </el-form-item>
          <el-form-item label="姓名">
            <span>{{ props.row.name }}</span>
          </el-form-item>
          <el-form-item label="感染状况">
            <span>{{ props.row.infectstatus }}</span>
          </el-form-item>
          <el-form-item label="是否就医">
            <span>{{ props.row.medicalcondition }}</span>
          </el-form-item>
          <el-form-item label="体温">
            <span>{{ props.row.temprature }}</span>
          </el-form-item>
          <el-form-item label="填写日期">
            <span>{{ props.row.fillingtime }}</span>
          </el-form-item>
          <el-form-item label="居住情况">
            <span>{{ props.row.livingstatus }}</span>
          </el-form-item>
        </el-form>
      </template>
    </el-table-column>

    <el-table-column label="表单编号" prop="formno"> </el-table-column>
    <el-table-column label="姓名" prop="name"> </el-table-column>
    <el-table-column label="填写日期" prop="fillingtime"> </el-table-column>
  </el-table>
</template>

<script>
export default {
  data() {
    return {
      healthTableData: {
        formno: "",
        name: "",
        infectstatus: "",
        medicalcondition: "",
        temprature: "",
        fillingtime: "",
        livingstatus: "",
      },
    };
  },
  created() {
    //请求用户个人信息
    this.$axios
      .get("/api/healthtable", {
        headers: { Authorization: "Bearer " + this.$store.state.token },
      })
      .then((response) => {
        //console.log(response)
        var pushlist = [];
        this.healthtablelist = response.data.healthtable;

        this.healthtablelist.forEach(function(value, index) {
          console.log(value[0]);
          pushlist.push({
            formno: value[0],
            infectstatus: value[1],
            medicalcondition: value[2],
            temprature: value[3],
            fillingtime: value[4],
            livingstatus: value[5],
            name: response.data.name[index],
          });
        });
        this.healthTableData = pushlist;
      });
  },
};
</script>

<style>
/* 列表css */
.demo-table-expand {
  font-size: 0;
}
.demo-table-expand label {
  width: 90px;
  color: #99a9bf;
}
.demo-table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
  width: 50%;
}
</style>
